package com.xsl.culture.mybasevideoview.view.secondui;

import android.os.Bundle;
import android.view.Window;
import android.webkit.WebView;

import com.xsl.culture.R;
import com.xsl.culture.mybasevideoview.MainActivity;
import com.xsl.culture.mybasevideoview.base.LanBaseActivity;
import com.xsl.culture.mybasevideoview.utils.UiUtils;
import com.xsl.culture.mybasevideoview.utils.XslUtils;
import com.xsl.culture.mybasevideoview.view.LanguageActivity;

import java.lang.ref.WeakReference;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class CreditsActivity extends LanBaseActivity {

    @BindView(R.id.webview)
    WebView des;
//    @BindView(R.id.des)
//    TextView desTv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        UiUtils.hideBottomUIMenu(this);
        setContentView(R.layout.activity_credits_layout);
        XslUtils.hideStausbar(new WeakReference<>(this), true);
        ButterKnife.bind(this);

        des.setBackgroundColor(0); // 设置背景色
        des.getBackground().setAlpha(0); // 设置填充透明度 范围：0-255
//        des.loadData(strMsgChinese, "text/html", "");
        loadData();
    }

    private void loadData(){
        switch (MainActivity.curLangugue){
            case LanguageActivity.chinese:
                des.loadUrl("file:///android_asset/wenben.html");
                break;
            case LanguageActivity.cantonese:
                des.loadUrl("file:///android_asset/wenben_fan.html");
                break;
            case LanguageActivity.english:
                des.loadUrl("file:///android_asset/wenben_en.html");
                break;
        }
    }
    @OnClick(R.id.close_btn)
    void closeClick() {
        finish();
    }

    @OnClick(R.id.language)
    void language() {
        toActivity(DesActivity.class);
    }

    @Override
    public void updateLanguage() {
        loadData();
    }
}
